package com.photoeditor.demo.ad;

import android.app.Activity;

import com.common.commercialize.utils.TaskRunnable;
import com.photoeditor.demo.statistics.StatisticsConstant;


//import com.billing.base.svip.SVipManager;

/**
 * 订阅页进入应用app
 * <p>
 * Created by mutour on 2017/10/28.
 */

public class MainReturnAdProvider {

    private static final String TAG = "main";

    private final FullScreenAdProvider mAdProvider;

    public static final String SCENE_NAME = "bacehome";

    public Activity mActivity;

    public MainReturnAdProvider(Activity activity, String funStr) {
        mActivity = activity;
        mAdProvider = new FullScreenAdProvider(SCENE_NAME, AdKeyConstant.InappAdPlacementID.MAIN_RETURN_ID, -1);
        mAdProvider.addStatisticsInfo(StatisticsConstant.KEY_MAIN_PAGE_FUN, funStr);
    }

    public void loadAd() {
        if (mAdProvider.needRequest(0)) {
            mAdProvider.loadAd(mActivity);
        }
    }

    public void showAd(TaskRunnable runnable) {
        if (!mAdProvider.showAd(runnable, "main")) {
            if(runnable != null) {
                runnable.runSelfAdaptation();
            }
        }
    }

    public void destroyAd() {
        mAdProvider.destroyAd();
    }
}
